<script type="text/javascript">
	$(document).ready(function() {
		$("#tabs").tabs();
		
		$("#verified").tablesorter({
			widthFixed: true,
			widgets: ['zebra']
		}).tablesorterPager({
			container: $("#pager1")
		});

		$("#registered").tablesorter({
			widthFixed: true,
			widgets: ['zebra']
		}).tablesorterPager({
			container: $("#pager2")
		});
<?php if ($scholarship->type == 'privat') : ?>
		$("#invited").tablesorter({
			widthFixed: true,
			widgets: ['zebra']
		}).tablesorterPager({
			container: $("#pager3")
		});
<?php endif; ?>
	});

	function gotoinvitepage() {	
		var url = "<?php echo site_url($role.'/scholar/offer/invite/'.$scholarship->id); ?>";
		document.location.href = url;
	}

	function gotoverifypage() {
		var url = "<?php echo site_url($role.'/scholar/offer/verify/'.$scholarship->id); ?>";
		document.location.href = url;
	}
</script>

<div id="main-content" class="prepend-1 span-19 last">
	<h3>Detil Beasiswa - <?php echo $scholarship->name; ?></h3>
	<table>
		<tr>
			<td width="200"><label>Nama Beasiswa</label></td>
			<td><?php echo $scholarship->name; ?></td>
		</tr>
		<tr>
			<td><label>Awal Periode</label></td>
			<td><?php echo date(MONTH_YEAR_FORMAT, strtotime($scholarship->period_start)); ?></td>
		</tr>
		<tr>
			<td><label>Akhir Periode</label></td>
			<td><?php echo date(MONTH_YEAR_FORMAT, strtotime($scholarship->period_end)); ?></td>
		</tr>
		<tr>
			<td><label>Batas Pendaftaran</label></td>
			<td><?php echo date(DAY_FORMAT, strtotime($scholarship->deadline)); ?></td>
		</tr>
		<tr>
			<td><label>Jenis Beasiswa</label></td>
			<td><?php echo $scholarship->type.nbs(3); ?></td>
		</tr>
		<tr>
			<td><label>Sponsor</label></td>
			<td><?php echo $scholarship->sponsor; ?></td>
		</tr>
		<tr>
			<td><label>Berkas Dibutuhkan</label></td>
			<td><?php echo $scholarship->required_files; ?></td>
		</tr>
		<tr>
			<td><label>Keterangan</label></td>
			<td><?php echo $scholarship->details; ?></td>
		</tr>
		<tr>
			<td><label>Status</label></td>
			<td><span class="info"><?php echo $status; ?></span></td>
		</tr>
		<tr>
			<td><b>Jumlah Pendaftar</b></td>
			<td><?php echo $counter + $verified; ?></td>
		</tr>
		<tr>
			<td><b>Jumlah Pendaftar Terverifikasi</b></td>
			<td><?php echo $verified; ?></td>
		</tr>
<?php if ($scholarship->type == 'privat') : ?>
		<tr>
			<td><b>Jumlah Mahasiswa Ditawarkan</b></td>
			<td><?php echo $invited; ?></td>
		</tr>
<?php endif; ?>
	</table>
<?php if ($scholarship->type == 'privat') : ?>
	<div class="clear"><?php echo nbs(); ?></div>
	<h4>Undang Mahasiswa untuk Mendaftar Beasiswa Privat</h4>
	<input type="button" class="submit" name="invite" value="Undang Mahasiswa" onclick="gotoinvitepage()" />
<?php endif; ?>
	<div class="clear"><?php echo nbs(); ?></div>
	<h4>Verifikasi Pendaftaran Beasiswa</h4>
	<input type="button" class="submit" name="verify" value="Verifikasi Pendaftaran" onclick="gotoverifypage()" />

	<div class="clear"><?php echo nbs(); ?></div>
	<h4>Daftar Mahasiswa Pendaftar Beasiswa</h4>
<div id="tabs">
	<ul>
		<li><a href="#tabs-1">Pendaftar Beasiswa</a></li>
		<li><a href="#tabs-2">Pendaftar Terverifikasi</a></li>
<?php if ($scholarship->type == 'privat') : ?>
		<li><a href="#tabs-3">Daftar Mahasiswa Ditawarkan</a></li>
<?php endif; ?>
	</ul>
	<div id="tabs-2">
	<table id="verified">
	<thead>
		<tr>
			<th>Nama Mahasiswa</th>
			<th width="150">Angkatan</th>
			<th width="300">Program Studi</th>
			<th width="200"><?php echo $studentstatus; ?></th>
		</tr>
	</thead>
	<tfoot>
		<?php echo $pager1; ?>
	</tfoot>
	<tbody>
<?php 
	if ($recieversverified == NULL) :
?>
		<tr>
			<td align="center" colspan="4">
				<span class="info">Tidak ada mahasiswa pendaftar beasiswa yang terverifikasi.</span>
			</td>
		</tr>
<?php 
	else :
		foreach ($recieversverified as $recieververified) :
?>
		<tr>
			<td><?php echo anchor($role.'/student/profile/index?id='.$recieververified->id, $recieververified->name, array('target' => '_blank')); ?></td>
			<td align="center"><?php echo $recieververified->year; ?></td>
			<td><?php echo $recieververified->major; ?></td>
			<td align="center" class="selectionstatus"><?php echo $recieververified->status; ?></td>
		</tr>
<?php 
		endforeach;
	endif;
?>
	</tbody>
	</table>
	</div>
	<div id="tabs-1">	
	<table id="registered">
	<thead>
		<tr>
			<th>Nama Mahasiswa</th>
			<th width="150">Angkatan</th>
			<th width="300">Program Studi</th>
			<th width="200"><?php echo $studentstatus; ?></th>
		</tr>
	</thead>
	<tfoot>
		<?php echo $pager2; ?>
	</tfoot>
	<tbody>
<?php 
	if ($recievers == NULL) :
?>
		<tr>
			<td align="center" colspan="4">
				<span class="info">Tidak ada mahasiswa pendaftar beasiswa ini.</span>
			</td>
		</tr>
<?php 
	else :
		foreach ($recievers as $reciever) :
?>
		<tr>
			<td><?php echo anchor($role.'/student/profile/index?id='.$reciever->id, $reciever->name, array('target' => '_blank')); ?></td>
			<td align="center"><?php echo $reciever->year; ?></td>
			<td><?php echo $reciever->major; ?></td>
			<td align="center" class="selectionstatus"><?php echo $reciever->status; ?></td>
		</tr>
<?php 
		endforeach;
	endif;
?>
	</tbody>
	</table>
	</div>
<?php if ($scholarship->type == 'privat') : ?>
	<div id="tabs-3">
	<table id="invited">
	<thead>
		<tr>
			<th>Nama Mahasiswa</th>
			<th width="150">Angkatan</th>
			<th width="300">Program Studi</th>
		</tr>
	</thead>
	<tfoot>
		<?php echo $pager3; ?>
	</tfoot>
	<tbody>
<?php 
	if ($recieversinvited == NULL) :
?>
		<tr>
			<td align="center" colspan="3">
				<span class="info">Tidak ada mahasiswa pendaftar beasiswa yang ditawarkan.</span>
			</td>
		</tr>
<?php 
	else : 
		foreach ($recieversinvited as $recieverinvited) :
?>
		<tr>
			<td><?php echo anchor($role.'/student/profile/index?id='.$recieverinvited->id, $recieverinvited->name, array('target' => '_blank')); ?></td>
			<td align="center"><?php echo $recieverinvited->year; ?></td>
			<td><?php echo $recieverinvited->major; ?></td>
		</tr>
<?php 
		endforeach;
	endif;
?>
	</tbody>
	</table>
	</div>
<?php endif; ?>
</div>
	<div class="clear"><?php echo nbs(); ?></div>
</div>